#############################################################################################
#                                                                                           #
#                   Copyright 2010-2013 Ning, Inc.                                          #
#                   Copyright 2014 Groupon, Inc.                                            #
#                   Copyright 2014 The Billing Project, LLC                                 #
#                                                                                           #
#      The Billing Project licenses this file to you under the Apache License, version 2.0  #
#      (the "License"); you may not use this file except in compliance with the             #
#      License.  You may obtain a copy of the License at:                                   #
#                                                                                           #
#          http://www.apache.org/licenses/LICENSE-2.0                                       #
#                                                                                           #
#      Unless required by applicable law or agreed to in writing, software                  #
#      distributed under the License is distributed on an "AS IS" BASIS, WITHOUT            #
#      WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the            #
#      License for the specific language governing permissions and limitations              #
#      under the License.                                                                   #
#                                                                                           #
#############################################################################################


#
#                       DO NOT EDIT!!!
#    File automatically generated by killbill-java-parser (git@github.com:killbill/killbill-java-parser.git)
#


module Killbill
  module Plugin
    module Model

      java_package 'org.killbill.billing.catalog.api.rules'
      class PlanRules

        include org.killbill.billing.catalog.api.rules.PlanRules

        attr_accessor :case_change_plan_policy, :case_change_plan_alignment, :case_cancel_policy, :case_create_alignment, :case_billing_alignment, :case_price_list

        def initialize()
        end

        def to_java()
          # conversion for case_change_plan_policy [type = java.lang.Iterable]
          tmp = java.util.ArrayList.new
          (@case_change_plan_policy || []).each do |m|
            # conversion for m [type = org.killbill.billing.catalog.api.rules.CaseChangePlanPolicy]
            m = m.to_java unless m.nil?
            tmp.add(m)
          end
          @case_change_plan_policy = tmp

          # conversion for case_change_plan_alignment [type = java.lang.Iterable]
          tmp = java.util.ArrayList.new
          (@case_change_plan_alignment || []).each do |m|
            # conversion for m [type = org.killbill.billing.catalog.api.rules.CaseChangePlanAlignment]
            m = m.to_java unless m.nil?
            tmp.add(m)
          end
          @case_change_plan_alignment = tmp

          # conversion for case_cancel_policy [type = java.lang.Iterable]
          tmp = java.util.ArrayList.new
          (@case_cancel_policy || []).each do |m|
            # conversion for m [type = org.killbill.billing.catalog.api.rules.CaseCancelPolicy]
            m = m.to_java unless m.nil?
            tmp.add(m)
          end
          @case_cancel_policy = tmp

          # conversion for case_create_alignment [type = java.lang.Iterable]
          tmp = java.util.ArrayList.new
          (@case_create_alignment || []).each do |m|
            # conversion for m [type = org.killbill.billing.catalog.api.rules.CaseCreateAlignment]
            m = m.to_java unless m.nil?
            tmp.add(m)
          end
          @case_create_alignment = tmp

          # conversion for case_billing_alignment [type = java.lang.Iterable]
          tmp = java.util.ArrayList.new
          (@case_billing_alignment || []).each do |m|
            # conversion for m [type = org.killbill.billing.catalog.api.rules.CaseBillingAlignment]
            m = m.to_java unless m.nil?
            tmp.add(m)
          end
          @case_billing_alignment = tmp

          # conversion for case_price_list [type = java.lang.Iterable]
          tmp = java.util.ArrayList.new
          (@case_price_list || []).each do |m|
            # conversion for m [type = org.killbill.billing.catalog.api.rules.CasePriceList]
            m = m.to_java unless m.nil?
            tmp.add(m)
          end
          @case_price_list = tmp
          self
        end

        def to_ruby(j_obj)
          # conversion for case_change_plan_policy [type = java.lang.Iterable]
          @case_change_plan_policy = j_obj.case_change_plan_policy
          tmp = []
          (@case_change_plan_policy.nil? ? [] : @case_change_plan_policy.iterator).each do |m|
            # conversion for m [type = org.killbill.billing.catalog.api.rules.CaseChangePlanPolicy]
            m = Killbill::Plugin::Model::CaseChangePlanPolicy.new.to_ruby(m) unless m.nil?
            tmp << m
          end
          @case_change_plan_policy = tmp

          # conversion for case_change_plan_alignment [type = java.lang.Iterable]
          @case_change_plan_alignment = j_obj.case_change_plan_alignment
          tmp = []
          (@case_change_plan_alignment.nil? ? [] : @case_change_plan_alignment.iterator).each do |m|
            # conversion for m [type = org.killbill.billing.catalog.api.rules.CaseChangePlanAlignment]
            m = Killbill::Plugin::Model::CaseChangePlanAlignment.new.to_ruby(m) unless m.nil?
            tmp << m
          end
          @case_change_plan_alignment = tmp

          # conversion for case_cancel_policy [type = java.lang.Iterable]
          @case_cancel_policy = j_obj.case_cancel_policy
          tmp = []
          (@case_cancel_policy.nil? ? [] : @case_cancel_policy.iterator).each do |m|
            # conversion for m [type = org.killbill.billing.catalog.api.rules.CaseCancelPolicy]
            m = Killbill::Plugin::Model::CaseCancelPolicy.new.to_ruby(m) unless m.nil?
            tmp << m
          end
          @case_cancel_policy = tmp

          # conversion for case_create_alignment [type = java.lang.Iterable]
          @case_create_alignment = j_obj.case_create_alignment
          tmp = []
          (@case_create_alignment.nil? ? [] : @case_create_alignment.iterator).each do |m|
            # conversion for m [type = org.killbill.billing.catalog.api.rules.CaseCreateAlignment]
            m = Killbill::Plugin::Model::CaseCreateAlignment.new.to_ruby(m) unless m.nil?
            tmp << m
          end
          @case_create_alignment = tmp

          # conversion for case_billing_alignment [type = java.lang.Iterable]
          @case_billing_alignment = j_obj.case_billing_alignment
          tmp = []
          (@case_billing_alignment.nil? ? [] : @case_billing_alignment.iterator).each do |m|
            # conversion for m [type = org.killbill.billing.catalog.api.rules.CaseBillingAlignment]
            m = Killbill::Plugin::Model::CaseBillingAlignment.new.to_ruby(m) unless m.nil?
            tmp << m
          end
          @case_billing_alignment = tmp

          # conversion for case_price_list [type = java.lang.Iterable]
          @case_price_list = j_obj.case_price_list
          tmp = []
          (@case_price_list.nil? ? [] : @case_price_list.iterator).each do |m|
            # conversion for m [type = org.killbill.billing.catalog.api.rules.CasePriceList]
            m = Killbill::Plugin::Model::CasePriceList.new.to_ruby(m) unless m.nil?
            tmp << m
          end
          @case_price_list = tmp
          self
        end

      end
    end
  end
end
